package com.woniuxy.amusementparkos.service.xxy.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.woniuxy.amusementparkos.dao.xxy.GoodDao;
import com.woniuxy.amusementparkos.entity.xxy.Good;
import com.woniuxy.amusementparkos.exception.xxy.SelectException;
import com.woniuxy.amusementparkos.service.xxy.GoodService;
@Service
public class GoodServiceImpl implements GoodService {
	@Autowired
	GoodDao goodDao;
	@Override
	public List<Good> selectAllGoods(int store_id) {
		try {
			List<Good> goods = goodDao.selectAllGoods(store_id);
			return goods;
		} catch (Exception e) {
			e.printStackTrace();
			throw new SelectException("系统错误,查询失败,请联系管理员");
		}
		
	}
	@Override
	public long selectAllGoodsCount() {
		try {
			return goodDao.selectAllGoodsCount();
		} catch (Exception e) {
			e.printStackTrace();
			throw new SelectException("系统错误,查询失败,请联系管理员");
		}
	}
	@Override
	public void insertGood(Good good) {
		try {
			goodDao.insertGood(good);
		} catch (Exception e) {
			e.printStackTrace();
			throw new SelectException("系统错误,查询失败,请联系管理员");
		}
		
	}
	@Override
	public void updateGood(Good good) {
		try {
			goodDao.updateGood(good);
		} catch (Exception e) {
			e.printStackTrace();
			throw new SelectException("系统错误,查询失败,请联系管理员");
		}
		
		
	}
	@Override
	public void deleteGood(Good good) {
		try {
			goodDao.deleteGood(good);
		} catch (Exception e) {
			e.printStackTrace();
			throw new SelectException("系统错误,查询失败,请联系管理员");
		}
		
	}
	@Override
	public Good selectGoodByGid(int good_id) {
		try {
			return goodDao.selectGoodByGid(good_id);
		} catch (Exception e) {
			e.printStackTrace();
			throw new SelectException("系统错误,查询失败,请联系管理员");
		}
	}

}
